namespace DotNetNuke.Entities.Users
{
    using System;

    public class UserInfo
    {
        private int _AffiliateID = -1;
        private string _FirstName;
        private string _FullName;
        private bool _IsSuperUser = false;
        private string _LastName;
        private UserMembership _Membership = new UserMembership();
        private int _PortalID = -1;
        private UserProfile _Profile = new UserProfile();
        private int _UserID = -1;
        private string _Username;

        public int AffiliateID
        {
            get
            {
                return this._AffiliateID;
            }
            set
            {
                this._AffiliateID = value;
            }
        }

        public string FirstName
        {
            get
            {
                if (this._FirstName == "")
                {
                    this._FirstName = this.Profile.FirstName;
                }
                return this._FirstName;
            }
            set
            {
                this._FirstName = value;
            }
        }

        public string FullName
        {
            get
            {
                if (this._FullName == "")
                {
                    this._FullName = this.FirstName + " " + this.LastName;
                }
                return this._FullName;
            }
            set
            {
                this._FullName = value;
            }
        }

        public bool IsSuperUser
        {
            get
            {
                return this._IsSuperUser;
            }
            set
            {
                this._IsSuperUser = value;
            }
        }

        public string LastName
        {
            get
            {
                if (this._LastName == "")
                {
                    this._LastName = this.Profile.LastName;
                }
                return this._LastName;
            }
            set
            {
                this._LastName = value;
            }
        }

        public UserMembership Membership
        {
            get
            {
                if ((((!this._Membership.ObjectHydrated && (this.Username != null)) && (this.Username.Length > 0)) ? 1 : 0) != 0)
                {
                    this._Membership = new UserController().FillUserMembership(this);
                    this._Membership.ObjectHydrated = true;
                }
                return this._Membership;
            }
            set
            {
                this._Membership = value;
                this._Membership.ObjectHydrated = true;
            }
        }

        public int PortalID
        {
            get
            {
                return this._PortalID;
            }
            set
            {
                this._PortalID = value;
            }
        }

        public UserProfile Profile
        {
            get
            {
                if ((((!this._Profile.ObjectHydrated && (this.Username != null)) && (this.Username.Length > 0)) ? 1 : 0) != 0)
                {
                    this._Profile = new UserController().FillUserProfile(this);
                    this._Profile.ObjectHydrated = true;
                }
                return this._Profile;
            }
            set
            {
                this._Profile = value;
                this._Profile.ObjectHydrated = true;
            }
        }

        public int UserID
        {
            get
            {
                return this._UserID;
            }
            set
            {
                this._UserID = value;
            }
        }

        public string Username
        {
            get
            {
                return this._Username;
            }
            set
            {
                this._Username = value;
            }
        }
    }
}

